package se.webbzon.boltzmann.player;

public class PlayerCoins {
	
	// The maximal top health of a player
	private static final int topCoins = 999;
	
	// The current maximal health of the player
	private int maxCoins;
	
	// The current health of the player
	private int coins;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new player coin instance with a maximal coin limit
	 * of 99 coins and zero collected coins. **/
	public PlayerCoins() {
		this(99,0);
	}
	
	/** Creates a new player coin instance with the given amount
	 * of collected coins and a maximal coin limit. **/
	public PlayerCoins(int maxCoins, int coins) {
		this.maxCoins = (maxCoins > topCoins) ? topCoins : maxCoins;
		this.coins = (coins > this.maxCoins) ? this.maxCoins : coins;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the number of collected coins of the player. **/
	public int getCoins() {
		return coins;
	}

	/** Sets the number of collected coins of the player. **/
	public void setCoins(int coins) {
		this.coins = (coins > maxCoins) ? maxCoins : coins;
	}
	
	/** Returns the maximal coin limit of the player. **/
	public int getMaxCoins() {
		return maxCoins;
	}
	
	/** Sets the maximal coin limit of the player. **/
	public void setMaxCoins(int maxCoins) {
		this.maxCoins = (maxCoins > topCoins) ? topCoins : maxCoins;
	}

}
